// Grants the User Access to the ACV or not
diag_log Format["ACV_Grant.sqf: %1", _this];
if (typeName _this != "ARRAY") exitWith {diag_log Format["ACV_Grant.sqf: Not a parameter array"];};
private ["_grant","_slot","_target","_functionality"];

_grant = true;
_functionality = "";
_slot = "";
_target = "";
If (count _this > 0) then {
	_grant = _this select 0;
	_functionality = _this select 1;
	_slot = _this select 2;
	if (typeName _slot != "STRING") then { _slot = str(_slot); };
	_target = _this select 3;
	if (typeName _grant != "BOOL") exitWith {diag_log Format["ACV_Grant.sqf: Not a boolean (_grant: %1)",_grant];};
	if (typeName _slot != "STRING") exitWith {diag_log Format["ACV_Grant.sqf: Not a string (_slot: %1)",_slot];};
	if (typeName _target != "STRING") exitWith {diag_log Format["ACV_Grant.sqf: Not a string (_target: %1)",_target];};
	if (typeName _functionality != "STRING") exitWith {diag_log Format["ACV_Grant.sqf: Not a string (_functionality: %1)",_functionality];};

	_functionality = toUpper(_functionality);
	if ((_slot != "") and (_slot != str(player))) exitWith {diag_log Format["ACV_Grant.sqf: Slot do not match (%1 <> %2)",_slot, str(player)];};
	if ((_target != "") and (_target != name player)) exitWith {diag_log Format["ACV_Grant.sqf: Target do not match (%1 <> %2)",_target, name player];};
	if (_functionality != "") then {
		switch (_functionality) do {
			case "ACV":	{ diag_log Format["ACV_Grant.sqf: Granting: %1",_functionality]; ACV_Granted = _grant;	};
			default { diag_log Format["ACV_Grant.sqf: Unknown Functionnality: %1",_functionality]; };
		};
	};
};
